\documentclass[UTF8,a4paper]{ctexart}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{breqn}

\newcommand{\degree}{^\circ}
\newcommand{\mi}{\mathrm{i}}
\newcommand{\me}{\mathrm{e}}

\DeclareMathOperator{\dif}{d\!}

\title{\heiti 玩转数学公式}
\author{\kaishu 徐皓玮}
\date{\today}
\begin{document}
	\maketitle
	\tableofcontents
	\heiti{
		\section{数学模式概说}
		%In-Text
		交换律是 $a+b=b+a$，如$1+2=2+1=3$。
		
		也可以是：\(a+b=b+a\)，如\(1+2=2+1=3\)。
		
		也可以是：\begin{math}
			a+b=b+a
		\end{math}，如\begin{math}
			1+2=2+1=3
		\end{math}。
		
		不能是：交换律是 a+b=b+a，如1+2=2+1=3。
		
		交换律是
		\[
			a+b=b+a, 
		\]
		如
		\[
			1+2=2+1=3
		\]
		\begin{equation}
			a+b=b+a
			\label{commutative}
		\end{equation}
		公式\ref{commutative}即为交换律。
		
		$\text{被减数}-\text{减数} = \text{差}$
		
		已知的变量有 $a$, $b$, $c$, $d$, $S$, $R$, 和 $T$。
		\section{数学结构}
			\subsection{上标与下标}
				  $A_{ij} = 2^{i+j}$ \qquad
				  $A_i^k = B^k_i$ \qquad
				  $K_{n_i} = K_{2^i} = 2^{n_i}
				  		   = 2^{2^i}$ \qquad
				  $3^{3^{3^{\cdot^{\cdot^{\cdot^3}}}}}$
				  
				  $a = a'$ \qquad $b_0' = b_0''$ \qquad 
				  ${c'}^2 = (c')^2$
				  
				  $A = 90\degree$
				  
				  \[
				  	\max_n f(n) = \sum_{i = 0}^n A_i
				  \]
				  
				  \[
				  	\int_{0}^{1} f(t) \dif t
				  	= \iint_D g(x,y) \dif x \dif y
				  \]
			\subsection{上下划线与花括号}
				\[
					\overline{a+b} = 
					\overline{a} + \overline{b}
				\]
				\[
					\underline{a} = (a_0, a_1, a_2,\dots)
				\]
				\[
					\overline{\underline{\underline{a}}
					+ \overline{b^2}} - c^{\underline{n}}
				\]
				\[
					\overrightarrow{AB} + \overrightarrow{BC} = 
					\overrightarrow{AC}
				\]
				\[
					(\overbrace{a_0,a_1,\dots,a_n}
					^{\text{共 $n+1$ 项}} ) =
					( \underbrace{0,0,\dots,0}_{n}, 1)
				\]
			\subsection{分式}
				\[
					\frac{1}{2} + \frac{1}{a}
					= \frac{2+a}{2a}
				\]
				\[
					\frac{1}{\frac{1}{2}(a+b)} = \frac{2}{a+b}
				\]
				\[
					\dfrac{1}{2}f(x) = 
					\dfrac{1}{\dfrac{1}{a}+\dfrac{1}{b}+c}
				\]
				\[
					\cfrac{1}{1+\frac{2}{1+\cfrac{3}{1+x}}}
				\]
				\[
					(a+b)^2 = \binom{2}{0} a^2
							  + \binom{2}{1} ab + 
							  \binom{2}{2} b^2
				\]
			\subsection{根式}
				\[
					\sqrt{4} = \sqrt[3]{8} = 2
				\]
				\[
					\sqrt[n]{\frac{x^2 + \sqrt{2}}{x + y}}
				\]
				\[
					\sqrt[\uproot{16}\leftroot{-2}n]{\frac{x^2 + \sqrt{2}}{x + y}}
				\]
			\subsection{矩阵}
				\[
					A = \begin{pmatrix}
						a_{11} & a_{12} & a_{13} \\
						0 & a_{22} & a_{23} \\
						0 & 0 & a_{33}
					\end{pmatrix}
				\]
				\[
					A = \begin{bmatrix}
						a_{11} & \dots & a_{1n} \\
						 & \ddots & \vdots \\
						0 & & a_{nn}
					\end{bmatrix}_{n \times n}
				\]
		\section{符号与类型}
			\subsection{字母表与普通符号}
			$\mi$ \qquad $\me$
			\[
				\alpha \quad \beta \quad \gamma \quad \delta  \qquad
				\epsilon \quad \zeta \quad \eta \quad \theta  \qquad
				\kappa \quad \lambda \quad \mu \quad \nu \qquad	 
				\xi \quad \pi \quad \rho \quad \sigma \qquad 
				\tau \quad \phi \quad \chi \quad \psi \qquad 
			\]
			
			\[
				e^{\pi \mi} + 1 = 0
			\]
			\[
				\text{空集}\varPhi \text{的基数是}0 \text{,自然数集}
				\mathbb{R}
			\]
			\subsection{数学算子}
			\[
				\mathcal{F}(x) = \sum_{k=0}^{\infty} \oint_0^1
				 f_k(x,t) \dif t
			\]
			\[
				\iiint \limits_{\Omega}f(x,y,z) \dif V
			\]
			\[
				\cos 2x = \cos (x+x) = \cos^2 x - \sin^2 x
			\]
			\[
				\sin 2x = \sin (x+x) = 2 \sin x \cos x
			\]
			\[
				\int_0^1 \int_0^1 f(x,y) \int_0^1 
				\frac{\dif z}{g(x,y,z)} \dif x \dif y
			\]
			Gauss-Bonnet公式：
			\[
				\oint_{C} \kappa_{g} \dif s +
				\iint_{D} K \dif \sigma = 
				2\pi - \sum_{i=1}^{n} \alpha_i
			\]
			\[
				\lim_{N \to +\infty} \frac{1}{2\pi} 
				\int_{-N}^{N} \hat{f}(\lambda) e^{\mi \lambda x}
				\dif \lambda = f(x)
			\]
			\[
				\frac{\partial z}{\partial x} = 
				\frac{\partial z}{\partial u} \frac{\partial u}{\partial x} + \frac{\partial z}{\partial v} \frac{\partial v}{\partial x}
			\]
			\subsection{二元运算符与关系符}
				略。
			\subsection{括号与定界符}
				略。
			\subsection{标点}
				\[
					\prod_{i=1}^{n} a_i = a_1 \dotsm a_n
				\]
		\section{多行公式}
			\subsection{罗列多个公式}
			\begin{gather}
				a+b = b+a \\
				a \times b = b \times a
			\end{gather}
			
			\begin{align}
				x &= t + \cos t + 1 \\
			 	y &= 2 \sin t
			\end{align}
			
			\begin{align*}
				x &= t		& x &= \cos t		& x &= t \\
				y &= 2t		& y &= \sin(t+1)	& y &= \sin t 
			\end{align*}
			
			\begin{align}
			%缺少关系符，需要使用幻影给关系符占位，
			%并利用\mathrel保证间距
				&\mathrel{\phantom{=}}
				 (a+b)(a^2-ab+b^2) \notag \\
			  &= a^3 - a^2b + ab^2 + a^2b - ab^2 + b^2 \notag \\
			  &= a^3 + b^3
			\end{align}
			\begin{align*}
				x^2 + 2x &= -1
				\shortintertext{移项得}
				x^2 + 2x + 1 &= 0
			\end{align*}
			\begin{subequations}
				由以上关系可以得到：
				\begin{align}
					a_{11}x + a_{12}y + a{13}z = A \\
					a_{21}x + a_{22}y + a{23}z = B \\
					a_{31}x + a_{32}y + a{33}z = C
				\end{align}
				
			\end{subequations}
			\subsection{拆分单个公式}
				\begin{align}
			\begin{split}
			\cos 2x &= \cos^2 x - \sin^2 x \\
			&= \cos^2 x - ( 1 - \cos^2 x) \\
			&= 2 \cos^2 x - 1 \\
			&= (1 - \sin^2 x) - \sin^2 x \\
			&= 1 - 2 \sin^2 x
			\end{split}
			\end{align}
			
			\begin{align}
			\begin{split}
			\frac{1}{2}(\sin (x+y) + sin(x-y))
			&= \frac{1}{2}(\sin x \cos y + \cos x \sin y) \\
			&\quad + \frac{1}{2}(\sin x \cos y - \cos x \sin y) \\
			&= \sin x \cos y
			\end{split}
			\end{align}
			
			\begin{dmath}
				\frac{1}{2}(\sin (x+y) + sin(x-y))
				= \frac{1}{2}(\sin x \cos y + \cos x \sin y) + \frac{1}{2}(\sin x \cos y - \cos x \sin y) = \sin x \cos y
			\end{dmath}
		
			\subsection{将公式组合成块}
				\begin{align}
					f(x) \stackrel{\Delta}{=} 
					\begin{cases}
						\frac{3}{2} - x, \quad \frac{1}{2} < x \leq 1, \\
						\frac{3}{4} - x, \quad \frac{1}{4} < x \leq \frac{1}{2}, \\
						\frac{3}{8} - x, \quad \frac{1}{8} < x \leq \frac{1}{4}, 
					\end{cases}
				\end{align}
				\[
					\left \lvert x - \frac{1}{2} \right \rvert
					= 
					\begin{dcases}
						x - \frac{1}{2}, & x \geq \frac{1}{2}; \\
						\frac{1}{2} - x, & x < \frac{1}{2}.
					\end{dcases}
				\]
		\section{精调与杂项}
			\subsection{公式编号控制}
			略。
			\subsection{公式的字号}
			略。
			\subsection{断行与数学间距}
			略。
	}	
\end{document}